
cc.Class({
    extends: cc.Component,

    properties: {
        effect:cc.Node
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.effect.active=false;
    },

    start () {
        let _self=this;
        if(!CC_WECHATGAME){
            return
        }
        var info = wx.getSystemInfoSync();
        document.addEventListener("touchstart", function(event) {
            if(this.effect){
                this.effect.active=true;
                var x = event.touches[0].clientX;
                var y = event.touches[0].clientY;
                var newx = cc.winSize.width / info.screenWidth * x;
                var newy = cc.winSize.height / info.screenHeight * (info.screenHeight - y);
                this.effect.getComponent(cc.Animation).play('touchEffect')
                this.effect.x = newx-this.node.width/2;
                this.effect.y = newy - this.node.height / 2;
            }
            
        }.bind(this));
    },
    // update (dt) {},
});
